/**
 * Copyright © 2020 易久批电子商务有限公司. All rights reserved.
 */
package com.dysm.imageprint;


/**
 * 此类可以读取一张GIF图片，动态输出到控制台
 * @author xiay
 * @since 2020/9/18 10:00 上午
 */
public class ConsoleColorPrintTest {


    public static void main(String[] args) throws Exception {
        for (int i = 0; i < 100; i++) {
            System.out.print(getFormatLogString(String.valueOf(i), i, 0) + ";");
        }
    }

    public static String getFormatLogString(String content, int colour, int type) {
        boolean hasType = type != 1 && type != 3 && type != 4;
        if (hasType) {
            return String.format("\033[%dm%S\033[0m", colour, content);
        } else {
            return String.format("\033[%d ;%dm%s\033[0m", colour, type, content);
        }
    }


}
